home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc / Developer Documentation / Recipes, Tech Notes & Articles / Tech Notes / Utilities Documentation / ODCPlusSemanticInterface < prev    next >
Encoding:
Text File  |  1995-11-06  |  3.2 KB  |  41 lines  |  [TEXT/ttxt]

  1. OpenDoc™ Utilities Documentation
  2.  
  3.  
  4. ODCPlusSemanticInterface
  5. 10/31/95
  6.  
  7. © 1993-1995  Apple Computer, Inc. All Rights Reserved.
  8. Apple, the Apple logo, and Macintosh are registered trademarks of Apple Computer, Inc.
  9. Mac and OpenDoc are trademarks of Apple Computer, Inc. 
  10.  
  11. Introduction
  12.  
  13. To support Apple event-based OSA scripting in OpenDoc, you must create your own subclass of the System Object Model™ (SOM) class ODSemanticInterface. This document describes a set of files that are constitute a pre-rolled ODSemanticInterface subclass that you may wish to use. The methods of the helper class are similar to the functions of the Apple event Manager and the Object Support Library and thus may provide an easier way to convert your scripting code to OpenDoc.
  14.  
  15. ODCPlusSemanticInterface (SemtIntf.idl and SemtIntf.cpp)
  16.  
  17. This SOM class is a subclass of ODSemanticInterface that uses a C++ helper  class. You can use this SOM class as your ODSemanticInterface subclass to avoid the hassle of creating a new SOM class for yourself. Unfortunately, SOM class names have to be unique within a process, so you must rename this class before using it. Try using a name that contains your company name in order to assure uniqueness.
  18.  
  19. SIHelper (SIHlpAbs.h, SIHelper.h and SIHelper.cpp)
  20.  
  21. This C++ class is meant to be used in conjunction with the ODCPlusSemanticInterface SOM class. The methods of this class that ODCPlusSemanticInterface uses are enumerated in the abstract base class SIHelperAbs. This allows you to substitute a different implementation of the SIHelper class if you so desire. Most will probably want to stick with the SIHelper class itself, however. The methods of the helper class are similar to the functions of the Apple event Manager and the Object Support Library and should look familiar to anyone who has implemented scripting in an application.
  22.  
  23. Using ODCPlusSemanticInterface
  24.  
  25. Be sure to rename the class by searching and replacing all instances of the string ODCPlusSemanticInterface with a name of your choosing (use something unique in the name such as the name of your company or institution). Create instances of the the ODCPlusSemanticInterface class thus:
  26.  
  27.     MyODCPlusSemanticInterface* mySI = new MyODCPlusSemanticInterface;
  28.     SIHelper* semItfcHelper = new SIHelper;
  29.     semItfcHelper->InitSIHelper(session, mySI);
  30.     mySI>InitCPlusSemanticInterface(ev, somSelf, semItfcHelper, session);
  31.  
  32. Note that instances of the SIHelper class may be shared among instances of the ODCPlusSemanticInterface class. So, although each one of your part instances must create a new ODCPlusSemanticInterface instance, you might keep a reference to a single SIHelper class instance in a global variable (perhaps creating it the first time an instance of your part is created) and pass it into InitCPlusSemanticInterface.
  33.  
  34. SIHashTable and SIHashTableIterator (SIHshTbl.h, SIHshTbl.cpp)
  35.  
  36. The C++ class SIHashTable is a simple hash table class that is used by the SIHelper class to do dispatching to the proper callback function. It uses the functions defined in HshTbl.h.
  37.  
  38. Files to compile/link with
  39.  
  40. You must compile and link with the following files: SemtInft.cpp (remember to rename the SOM class before using), SIHelper.cpp, SIHshTbl.cpp and HshTbl.cpp. 
  41.